#include "bsp_led.h"

void BSP_Led_Init(void)
{
	stc_gpio_cfg_t stcGpioCfg;
    
    ///< 打开GPIO外设时钟门控
    Sysctrl_SetPeripheralGate(SysctrlPeripheralGpio, TRUE); 
    
    ///< 端口方向配置->输出 外部三极管驱动led,高电平点亮.
    stcGpioCfg.enDir = GpioDirOut;
	 ///< 端口驱动能力配置->高驱动能力
    stcGpioCfg.enDrv = GpioDrvH;
    ///< 端口上下拉配置-> none
    stcGpioCfg.enPu = GpioPuEnable;
    stcGpioCfg.enPd = GpioPdDisable;
    
    Gpio_Init(LEDR_PORT,LEDR_PIN, &stcGpioCfg);
	
	///< LED关闭
    Gpio_ClrIO(LEDR_PORT, LEDR_PIN);
    
}


void BSP_led_blink(en_led_t LED)
{
	if(LED == LED_RED)
	{
		M0P_GPIO->PEOUT ^= ((1UL)<<(LEDR_PIN));
	}
#if 0	
	if(LED == LED_YELLOW)
	{
		M0P_GPIO->PEOUT ^= ((1UL)<<(LEDY_PIN));
	}

	if(LED == LED_BLUE)
	{
		M0P_GPIO->PEOUT ^= ((1UL)<<(LEDB_PIN));
	}
	if(LED == LED_GREEN)
	{
		M0P_GPIO->PEOUT ^= ((1UL)<<(LEDG_PIN));
	}
#endif	
	return;
}






